package org.geektimes.projects.dependency.servlet;


import org.geektimes.projects.dependency.context.ComponentContext;
import org.geektimes.projects.microprofile.servlet.ApplicationContextListener;

import javax.annotation.Priority;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;

/**
 * @author biwin
 */
@Priority(2)
public class DependencyInjectionInitializerListener implements ApplicationContextListener {
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        ServletContext servletContext = sce.getServletContext();
        servletContext.log("Priority : 2 (Injection)");
        ComponentContext context = new ComponentContext();
        context.init(servletContext);
    }

    @Override
    public void contextDestroyed(ServletContextEvent sce) {

    }
}
